<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=">
<title>消息管理</title>
<link rel="stylesheet" href="__PUBLIC__/Admin/css/css.css">
<script src="__PUBLIC__/Admin/js/jquery-1.9.1.js"></script>
<script src="__PUBLIC__/Common/Layer/layer.js"></script>
<script>
//添加消息
function add(){
	parent.layer.open({
		type: 2,
		shadeClose: true,
		shade: 0.5,
		area: ['450px', '300px'],
		title: '添加消息',
		content: '{:U("Article/news_add")}'
	});
}

//编辑消息
function update(id){
	parent.layer.open({
		type: 2,
		shadeClose: true,
		shade: 0.5,
		area: ['450px', '300px'],
		title: '编辑信息',
		content: '{:U("Article/news_update")}?id='+id
	});
}

//删除消息
function del(id){
	$("#del"+id+" td").css('background','#CBDFF2');
	parent.layer.confirm('删除不可恢复，真的要进行操作吗？', {
		btn: ['确认','取消'], //按钮
		shade: 0.5 //显示遮罩
	}, function(){
		$.post("{:U('Article/news_del')}", { "id": id},function(data){
			if(data == 1){
				parent.layer.msg('操作成功', { icon: 1, time: 1000 }, function(){
						$("#del"+id).remove();
					});
			}else{
				parent.layer.msg('操作失败', {icon: 2, time: 2000 }); 
			}
		}, "json");
	},function(){
		$("#del"+id+" td").css('border-top','0');
		$("#del"+id+" td").css('border-bottom','1px solid #EFEFEF');
	});
}
</script>
</head>
<body>


<div class="nav">
	<div class="nav_title">
    	<h4><img class="nav_img" src="__PUBLIC__/Admin/img/tab.gif" /><span class="nav_a">消息列表</span></h4>
    </div>
    <div class="nav_button">
    	<a href="javascript:;" onclick="add()"><button class="button">+ 添加消息</button></a>
    </div>
</div>
<div class="list">
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
      <thead>
	    <tr>
	      <td width="10%"><div align="center">ID</div></td>
	      <td width="50%"><div align="center">消息</div></td>
	      <td width="20%"><div align="center">发布时间</div></td>
	      <td width="20%"><div align="center">操作</div></td>
        </tr>
        </thead>
        <tbody>
        <foreach name="list" item="vo">
	    <tr id="del{$vo.id}">
	      <td height="50"><div align="center">{$vo.id}</div></td>
	      <td><div style="text-indent:2em;" align="left">{$vo.news_info}</div></td>
	      <td><div align="center">{$vo.create_time|date="Y-m-d H:i:s",###}</div></td>
	      <td><div align="center">
	      <a class="a_button" href="javascript:;" onClick="update({$vo.id});">编辑</a>
	      <a class="a_button" href="javascript:;" onClick="del({$vo.id});">删除</a>
          </div></td>
        </tr>
        </foreach>
        </tbody>
  </table>
</div>

<!-- 分页 -->
<div class="page">
{$page}
</div>


</body>
</html>
